package com.jzr.bedside.ui.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jzr.bedside.R
import com.jzr.bedside.bean.MediaListBean
import com.jzr.bedside.bean.MediaListBean.DataBean
import com.jzr.bedside.bean.SkillListBean
import com.jzr.bedside.utils.GlideUtils


class MultMediaAdapter(data: MutableList<MediaListBean.DataBean>?) :
    BaseQuickAdapter<MediaListBean.DataBean, BaseViewHolder>(
        R.layout.item_multmedia,
        data
    ) {


    override fun convert(helper: BaseViewHolder?, item: MediaListBean.DataBean?) {

       val ivPic =  helper?.getView<ImageView>(R.id.ivPic)
        GlideUtils.load(mContext, item?.picUrl, ivPic)

        helper?.setText(R.id.tvTitle, item?.title)
        helper?.itemView?.setOnClickListener {
            onItemClick?.onListItemClick(item)
        }

    }


    private var onItemClick: onListItemClick? = null

    interface onListItemClick {
        fun onListItemClick(item: MediaListBean.DataBean?)
    }

    fun onListItemClick(onListItemClick: onListItemClick?) {
        this.onItemClick = onListItemClick
    }


}
